//获取前一页url数据
let categoryid=getQueryString('categoryid');
let brandname=getQueryString('brandname');
let productid=getQueryString('productid');
let category=getQueryString('category');
let pageid=getQueryString('pageid');
let productname=getQueryString('productname')

//导航
let nav=document.querySelector('nav')
let el1="";
el1=`<a href="./../index.html">首页&gt;</a>
<a href="./../pages/category_bijia.html?categoryid=${categoryid}&pageid=${pageid}&category=${category}">${category}></a>
<a href="#">${productname}</a>
<a href="#" id="botton" class="fr">筛选</a>`
nav.innerHTML=el1;

//info
let info=document.querySelector('.info');
let makeprice=document.querySelector('.makeprice');
let content=document.querySelector('.content');
fetch('http://chst.vip:1234/api/getproduct?productid='+productid)
.then(body=>body.json())
.then(res=>{
    let item=res.result[0]
    let el2=`
    <div class="pic">${item.productImg}</div>
    <div class="name">${item.productName}</div>
    <div class="comment1">
        <div class="price1">
            <div class="price2">
                <span>当前最低</span>
                <span>¥6000</span>
            </div>
            <div class="price2">
                <span>优选评论</span>
                <span>8266条</span>
            </div>
        </div>
    </div>`
    let el3=`${item.bjShop}`
info.innerHTML=el2;
//makeprice
makeprice.innerHTML=el3;
})

//comment-content
let el4="";
fetch('http://chst.vip:1234/api/getproductcom?productid='+productid)
.then(body=>body.json())
.then(res=>{
    console.log(res.result)
    res.result.forEach(item=>{
        el4+=`
    <div class="content1">
        <div class="ori">
            <span class="name">${item.comName}</span>
            <span class="time">${item.comTime}</span>
        </div>
        <div class="comment_content">
            ${item.comContent}
        </div>
        <div class="form">
            <span>${item.comFrom}</span>
        </div>
    </div>`
    })
    content.innerHTML=el4;
})
